;------------------------------------------------------------------------------;
;									       ;
;				     DEMO				       ;
;									       ;
;			 GRAFIX Demonstration Program			       ;
;									       ;
;									       ;
;				  Written By:				       ;
;			      Joseph A. Albrecht			       ;
;                        9250 Old Cedar Ave  Apt. 103                          ;
;			    Bloomington, MN  55425			       ;
;									       ;
;------------------------------------------------------------------------------;

;*******************************************************************************
Code	SEGMENT			;Define code segement

	ASSUME	CS:Code,DS:Code,ES:Code,SS:Code

	ORG	100H		;COM files start at 100H

Start:
	JMP	Main		;Skip past data

Delay	EQU	9

XOffset		DW 0
ColOffset	DW 0
Tandy11		DW ?
XAspect1	DW 12
YAspect1	DW 5
Intro		DW OFFSET Tandy320
Tandy320	DB 'GRAFIX Demo For 320x200x16 Graphics Mode'
Tandy640	DB 'GRAFIX Demo For 640x200x16 Graphics Mode'
Not_Resident	DB 10,13,'GRAFIX not installed!',7,13,10,'$'
DemoMsg1	DB 'Lines And Flashing Boxes'
DemoMsg2	DB 'Circles And Paint Filling'
DemoMsg3	DB 'Animation'
AnyKey		DB 'Press Any Key To Continue'

;Palette arrays for demo part 1
PAL1		DW 0,1,13,3,4,5,11,7,8,9,10,2,12,6,14,15
PAL2		DW 0,1,6,3,4,5,2,7,8,9,10,13,12,11,14,15
PAL3		DW 0,1,11,3,4,5,13,7,8,9,10,6,12,2,14,15
PAL4		DW 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15

;Horse image #1
Horse1	DB 30H,0H,1DH
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,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0H,0H,0H,0H
	DB 0FFH,0F0H,0H,0FFH,0H
	DB 0H,0H,0H,0H,0FFH
	DB 0F0H,0FFH,0H,0H,0H
	DB 0H,0H,0H,0FH,0F0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0FH,0F0H,0H
	DB 0H,0H,0H,0FH,0FFH
	DB 0F0H,0H,0H,0H,0H
	DB 0H,0H,0H,0FFH,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0FFH,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0FH,0F0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0FH,0F0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0FFH,0F0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0FFH,0F0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0FH,0FFH,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0FH,0FFH,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H
	DB 0H,0H,0H,0H,0H

;-------------------------------------------------------------------------------

Main:
	MOV	AX,0EE80H	;See if GRAFIX is resident
	MOV	BX,0		; ..
	INT	10H		; ..
	CMP	AX,0DEADH	; ..
	JE	Main2		;GRAFIX is resident, proceed with program
	MOV	AH,9		;GRAFIX is not resident, print error message
	LEA	DX,Not_Resident ; ..
	INT	21H		; ..
	INT	20H		; ..
Main2:
	MOV	AX,0EE80H	;See if TANDY11 driver is installed
	MOV	BX,12		; ..
	INT	10H		; ..
	MOV	Tandy11,AX	; ..
	MOV	AX,0EE80H	;Enable graphics functions
	MOV	BX,2		; .. 320x200x16 color graphics mode
	INT	10H		; ..

;Print intro message
Main3:
	MOV	AX,0EE19H	;Print Intro Message
	MOV	BX,ColOffset	; ..
	ADD	BX,1		; ..
	MOV	CX,12		; ..
	INT	10H		; ..
	MOV	AX,0EE1BH	; ..
	MOV	BX,0		; ..
	MOV	CX,40		; ..
	MOV	DX,Intro	; ..
	INT	10H		; ..
	CALL	PrintAnyKey	;Print Any Key... line
	CALL	ClearBuf	;Clear keyboard buffer
	CALL	WaitKey		;Wait for a key to be pressed
	CMP	AL,27		;ESC pressed?
	JNE	Main4		;No
	JMP	Demo4		;Yes, exit the program

;Part 1 of demo - Line and box demo with changing palettes
Main4:
	MOV	AX,0EE00H	;Clear the screen
	INT	10H		; ..
	MOV	AX,0EE19H	;Print demo 1 header
	MOV	BX,ColOffset	; ..
	ADD	BX,9		; ..
	MOV	CX,1		; ..
	INT	10H		; ..
	MOV	AX,0EE1BH	; ..
	MOV	BX,0		; ..
	MOV	CX,24		; ..
	LEA	DX,DemoMsg1	; ..
	INT	10H		; ..
	CALL	PrintAnyKey	;Print Any Key... line
	MOV	AX,0EE0BH	;Draw 1st line in BLUE (Default)
	MOV	BX,XOffset	; ..
	ADD	BX,10		; ..
	MOV	CX,10		; ..
	MOV	SI,XOffset	; ..
	ADD	SI,309		; ..
	MOV	DI,189		; ..
	INT	10H		; ..
	MOV	AX,0EE02H	;Set next color to YELLOW
	MOV	BX,1		; ..
	MOV	CX,14		; ..
	INT	10H		; ..
	MOV	AX,0EE0BH	;Draw 2nd line
	MOV	BX,XOffset	; ..
	ADD	BX,309		; ..
	MOV	CX,10		; ..
	MOV	SI,XOffset	; ..
	ADD	SI,10		; ..
	MOV	DI,189		; ..
	INT	10H		; ..
	MOV	AX,0EE0EH	;Draw a line box in RED
	MOV	BX,XOffset	; ..
	ADD	BX,10		; ..
	MOV	CX,10		; ..
	MOV	SI,XOffset	; ..
	ADD	SI,309		; ..
	MOV	DI,189		; ..
	MOV	DX,4		; ..
	INT	10H		; ..
	MOV	AX,0EE11H	;Draw a solid box in BROWN
	MOV	BX,XOffset	; ..
	ADD	BX,135		; ..
	MOV	CX,19		; ..
	MOV	SI,XOffset	; ..
	ADD	SI,184		; ..
	MOV	DI,68		; ..
	MOV	DX,6		; ..
	INT	10H		; ..
	MOV	AX,0EE11H	;Draw a solid box in GREEN
	MOV	BX,XOffset	; ..
	ADD	BX,135		; ..
	MOV	CX,131		; ..
	MOV	SI,XOffset	; ..
	ADD	SI,184		; ..
	MOV	DI,180		; ..
	MOV	DX,2		; ..
	INT	10H		; ..
	MOV	AX,0EE11H	;Draw a solid box in LT CYAN
	MOV	BX,XOffset	; ..
	ADD	BX,19		; ..
	MOV	CX,74		; ..
	MOV	SI,XOffset	; ..
	ADD	SI,68		; ..
	MOV	DI,123		; ..
	MOV	DX,11		; ..
	INT	10H		; ..
	MOV	AX,0EE11H	;Draw a solid box in LT MAGENTA
	MOV	BX,XOffset	; ..
	ADD	BX,251		; ..
	MOV	CX,74		; ..
	MOV	SI,XOffset	; ..
	ADD	SI,300		; ..
	MOV	DI,123		; ..
	MOV	DX,13		; ..
	INT	10H		; ..
	CALL	ClearBuf	;Clear the keyboard buffer
Demo1:
	MOV	AX,0EE13H	;Change palette entries (Set 1)
	LEA	DX,PAL1		; ..
	INT	10H		; ..
	MOV	AX,0EE83H	;Delay awhile
	MOV	BX,Delay	; ..
	INT	10H		; ..
	MOV	AX,0EE13H	;Change palette entries (Set 2)
	LEA	DX,PAL2		; ..
	INT	10H		; ..
	MOV	AX,0EE83H	;Delay awhile
	MOV	BX,Delay	; ..
	INT	10H		; ..
	MOV	AX,0EE13H	;Change palette entries (Set 3)
	LEA	DX,PAL3		; ..
	INT	10H		; ..
	MOV	AX,0EE83H	;Delay awhile
	MOV	BX,Delay	; ..
	INT	10H		; ..
	MOV	AX,0EE13H	;Change palette entries (Set 4)
	LEA	DX,PAL4		; ..
	INT	10H		; ..
	MOV	AX,0EE83H	;Delay awhile
	MOV	BX,Delay	; ..
	INT	10H		; ..
	CALL	CheckKey	;See if a key has been pressed
	JZ	Demo1		;If not continue on with demo
	CMP	AL,27		;ESC pressed?
	JNE	Demo2		;No
	JMP	Demo4		;Yes, exit the program

;Part 2 of demo - Draw circles and fill them with color
Demo2:
	MOV	AX,0EE14H	;Reset the color palette
	INT	10H		; ..
	MOV	AX,0EE00H	;Clear the screen
	INT	10H		; ..
	MOV	AX,0EE19H	;Print demo 2 header
	MOV	BX,ColOffset	; ..
	ADD	BX,9		; ..
	MOV	CX,1		; ..
	INT	10H		; ..
	MOV	AX,0EE1BH	; ..
	MOV	BX,0		; ..
	MOV	CX,25		; ..
	LEA	DX,DemoMsg2	; ..
	INT	10H		; ..
	CALL	PrintAnyKey	;Print Any Key... line
	MOV	AX,0EE02H	;Draw 1st circle in LT BLUE
	MOV	BX,1		; ..
	MOV	CX,9		; ..
	INT	10H		; ..
	MOV	AX,0EE0FH	; ..
	MOV	SI,XOffset	; ..
	ADD	SI,50		; ..
	MOV	DI,100		; ..
	MOV	BX,50		; ..
	INT	10H		; ..
	MOV	AX,0EE10H	;Fill 1st circle with YELLOW
	MOV	SI,XOffset	; ..
	ADD	SI,50		; ..
	MOV	DI,100		; ..
	MOV	BX,14		; ..
	MOV	CX,9		; ..
	INT	10H		; ..
	MOV	AX,0EE04H	;Set aspect ratio of 2nd circle to 12/5 or 24/5
	MOV	BX,[XAspect1]	; ..
	MOV	CX,[YAspect1]	; ..
	INT	10H		; ..
	MOV	AX,0EE02H	;Draw 2nd circle in RED
	MOV	BX,1		; ..
	MOV	CX,4		; ..
	INT	10H		; ..
	MOV	AX,0EE0FH	; ..
	MOV	SI,XOffset	; ..
	ADD	SI,170		; ..
	MOV	DI,100		; ..
	MOV	BX,50		; ..
	INT	10H		; ..
	MOV	AX,0EE10H	;Fill 2nd circle with BROWN
	MOV	SI,XOffset	; ..
	ADD	SI,170		; ..
	MOV	DI,100		; ..
	MOV	BX,6		; ..
	MOV	CX,4		; ..
	INT	10H		; ..
	MOV	AX,0EE04H	;Set aspect ratio of 3rd circle to 6/10
	MOV	BX,6		; ..
	MOV	CX,10		; ..
	INT	10H		; ..
	MOV	AX,0EE02H	;Draw 3rd circle in CYAN
	MOV	BX,1		; ..
	MOV	CX,3		; ..
	INT	10H		; ..
	MOV	AX,0EE0FH	; ..
	MOV	SI,XOffset	; ..
	ADD	SI,270		; ..
	MOV	DI,100		; ..
	MOV	BX,50		; ..
	INT	10H		; ..
	MOV	AX,0EE10H	;Fill 3rd circle with GRAY
	MOV	SI,XOffset	; ..
	ADD	SI,270		; ..
	MOV	DI,100		; ..
	MOV	BX,8		; ..
	MOV	CX,3		; ..
	INT	10H		; ..
	CALL	ClearBuf	;Clear keyboard buffer
	CALL	WaitKey		;Wait for a key to pressed
	CMP	AL,27		;ESC pressed?
	JNE	Demo2A		;No
	JMP	Demo4		;Yes, exit the program

;Part 3 of demo - Animation
Demo2A:
	MOV	AX,0EE00H	;Clear the screen
	INT	10H		; ..
	MOV	AX,0EE02H	;Set background color to GRAY
	MOV	BX,3		; ..
	MOV	CX,8		; ..
	INT	10H		; ..
	MOV	AX,0EE02H	;Set text color to LT BLUE
	MOV	BX,2		; ..
	MOV	CX,9		; ..
	INT	10H		; ..
	MOV	AX,0EE19H	;Print demo 3 header
	MOV	BX,ColOffset	; ..
	ADD	BX,16		; ..
	MOV	CX,1		; ..
	INT	10H		; ..
	MOV	AX,0EE1BH	; ..
	MOV	BX,0		; ..
	MOV	CX,9		; ..
	LEA	DX,DemoMsg3	; ..
	INT	10H		; ..
	CALL	PrintAnyKey	;Print Any Key... line
	CALL	ClearBuf	;Clear keyboard buffer
Demo3:
	MOV	DX,OFFSET Horse1 ;Put image of Horse1
	CALL	PutHorse	 ; ..
	MOV	DX,OFFSET Horse2 ;Put image of Horse2
	CALL	PutHorse	 ; ..
	MOV	DX,OFFSET Horse3 ;Put image of Horse3
	CALL	PutHorse	 ; ..
	MOV	DX,OFFSET Horse4 ;Put image of Horse4
	CALL	PutHorse	 ; ..
	MOV	DX,OFFSET Horse5 ;Put image of Horse5
	CALL	PutHorse	 ; ..
	CALL	CheckKey	;Check if a key was pressed
	JZ	Demo3		;If no key pressed then keep animating
	CALL	GetKey		;Get key just pressed
	CMP	AL,27		;ESC pressed?
	JE	Demo4		;Yes, exit the program
	CMP	Tandy11,0	;See if we should do demo in 640x200x16 mode
	JE	Demo4		; ..
	MOV	Tandy11,0	      ;Reset variables for 2nd pass thru program
	MOV	XOffset,160	      ; ..
	MOV	ColOffset,20	      ; ..
	MOV	[XAspect1],24	      ; ..
	MOV	[YAspect1],5	      ; ..
	MOV	Intro,OFFSET Tandy640 ; ..
	MOV	AX,0EE80H	;Enable graphics functions
	MOV	BX,11		; .. 640x200x16 color graphics mode
	INT	10H		; ..
	JMP	Main3
Demo4:
	CALL	ClearBuf	;Clear the keyboard buffer
	MOV	AX,0EE80H	;Return to 80x25 text mode
	MOV	BX,3		; ..
	INT	10H		; ..
	MOV	AX,4C00H	;Exit the program
	INT	21H		; ..

PutHorse:
	MOV	AX,0EE16H	;'Put' the image on the screen
	MOV	BX,2		;Use Pset option for 'Put'
	MOV	CX,3		;Do 3 horses
	MOV	SI,XOffset	;Set initial X,Y
	ADD	SI,28		; ..
	MOV	DI,85		; ..
PutHorse1:			;
	PUSH	SI		;Save X
	ADD	SI,54		;ADD X offset
	INT	10H		;CALL GRAFIX
	POP	SI		;Restore X
	ADD	SI,52		;Bump up to next position
	LOOP	PutHorse1	;Do next horse
	RET

;-------------------------------------------------------------------------------

WaitKey:
	CALL	ClearBuf	;Clear the keyboard buffer
	CALL	GetKey		;Now wait for a key to be pressed
	RET

ClearBuf:
	CALL	CheckKey	;Clear keyboard buffer
	JZ	ClearBuf1	; ..
	CALL	GetKey		; ..
	JMP	ClearBuf	; ..
ClearBuf1:
	RET

CheckKey:
	MOV	AH,1		;Check keyboard status
	INT	16H		; ..
	RET			; ..

GetKey:
	MOV	AH,0		;Get a key from the keyboard
	INT	16H		; ..
	RET

PrintAnyKey:
	MOV	AX,0EE19H	;Print Any Key... line
	MOV	BX,ColOffset	; ..
	ADD	BX,9		; ..
	MOV	CX,25		; ..
	INT	10H		; ..
	MOV	AX,0EE1BH	; ..
	MOV	BX,0		; ..
	MOV	CX,25		; ..
	LEA	DX,AnyKey	; ..
	INT	10H		; ..
	RET			; ..

Code	ENDS
;*******************************************************************************

	END	Start
